//! 简单的随机数生成
#![no_std]
#![allow(unsafe_code)]

static mut SEED: u32 = 1;

/// 输出 32 位随机数
pub fn rand() -> u32 {
    unsafe {
        SEED ^= SEED << 13;
        SEED ^= SEED >> 17;
        SEED ^= SEED << 5;
        SEED
    }
}

/// 设置随机数种子
pub fn srand(seed: u32) {
    unsafe {
        SEED = seed;
    }
}
